<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2017/6/5
  Time: 15:42
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title></title>
  <meta http-equiv="Content-Type" content="text/html charset=utf-8">
  <% response.setContentType("text/html;charset=UTF-8");%>
  <% request.setCharacterEncoding("utf-8");%>
</head>
<body>
<h1><a href="userAdd.jsp">新建用户</a></h1>
<table>
  <thead>
  <td>昵称</td>
  <td>id</td>
  <td>年龄</td>
  <td>password</td>
  <td></td>
  <td></td>
  </thead>
<c:forEach var="allUsers" items="${allUser}"  varStatus="status">
  <tr>
  <td>${allUsers.userName}</td>
  <td>${allUsers.id}</td>
  <td>${allUsers.age}</td>
  <td>${allUsers.password}</td>
  <td><a href="#" onclick="deleteUser(${allUsers.id})">删除用户</a></td>
  <td><a href="../../userUpdate.jsp?id=${allUsers.id}">更新用户信息</a></td>
  </tr>
</c:forEach>
</table>
</body>
<script>
  function deleteUser(uid){
    var xmlhttp;

      xmlhttp=new XMLHttpRequest();

    xmlhttp.open("POST","/delete/"+uid,true);
    xmlhttp.send();
    alert("删除成功")
  }
</script>
</html>
